<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 14-11-14
 * Time: 下午2:14
 * @author 郑钟良<zzl@ourstu.com>
 */

namespace Question\Widget;

use Think\Action;

class QuestionHomeWidget extends Action
{
    public function question($data_id=0,$data_type='question'){
        if($data_id!=0){
            if($data_type=='question'){
                $question=D('Question/Question')->getQuestion($data_id);
                $this->assign('question',$question);
                $this->display(T('Question@Public/_question'));
            }
            if($data_type=='answer'){
                $answer=D('Question/QuestionAnswer')->getAnswerWithQuestion($data_id);
                $this->assign('answer',$answer);
                $this->display(T('Question@Public/_answeredquestion'));
            }
        }
    }
} 